*07_results_shortrun_figures.do
cap clear

global indir1 "/disk/bulkw/mrashid/matching_project/master_crosswalks"
global censdata "/homes/data/census-ipums/v2019/dta/"

global root    = "/disk/bulkw/nencka/schooling_pandemic/2021_10_18_final/"
global input   "$root/Input"
global scripts "$root/Scripts"
global temp    "$root/Temp"
global output  "$root/Output"
global log     "$root/Log"
global figures "$root/Figures/sr"

log using      "$log/07_results_shortrun_figures", replace text

set scheme plotplain, perm 



*****************************************************************************
*****************************************************************************
*****************************************************************************

*Save graphs
cd "$figures"

	*Single diff graphs
	foreach x in baseline_1910_rby baseline_1920_rby baseline_1910_m_rby baseline_1920_m_rby baseline_1910_sby baseline_1920_sby baseline_1910_statec baseline_1920_statec baseline_1920_rby_npisample baseline_1920_rby_othernpi nozero_1910_rby nozero_1920_rby workc_1920_rby canwork_1920_rby {
			use "$temp/`x'", clear
			keep if strpos(parm, "age_bin#c.weeks_closed_3wks") | strpos(parm, "1b.age_bin#co.weeks_closed_3wks")
			gen bucket = _n 
			lab def bucket_ts  1 "0-5"  2 "6-10"  3 "11-14" 4 "15-18" 5 "19-21" 6 "22-25" 
			lab values  bucket bucket_ts
			twoway rcap min95 max95 bucket, lstyle(ci) lcolor(gs8) legend(off) xtitle(Age at census year) ysc(r(-0.05 0.05)) ylab(-0.05(0.01)0.05) yline(0, lpattern(dot) lcolor(black)) ytitle("Attended school (indicator)") title("")  || scatter estimate bucket, mstyle(p1) connect(l) legend(off) xlabel(1 "0-5"  2 "6-10"  3 "11-14" 4 "15-18" 5 "19-21" 6 "22-25")
		graph export "$figures/`x'.eps", replace 

		}

	*IHS single diff
	foreach x in ihs_1920 ihs_1910  {
			use "$temp/`x'", clear
			keep if strpos(parm, "age_bin#c.ihs_days_closed") | strpos(parm, "1b.age_bin#co.ihs_days_closed")
			gen bucket = _n 
			lab def bucket_ts  1 "0-5"  2 "6-10"  3 "11-14" 4 "15-18" 5 "19-21" 6 "22-25" 
			lab values  bucket bucket_ts
			twoway rcap min95 max95 bucket, lstyle(ci) lcolor(gs8) legend(off) xtitle(Age at census year) ysc(r(-0.05 0.05)) ylab(-0.05(0.01)0.05) yline(0, lpattern(dot) lcolor(black)) ytitle("Attended school (indicator)") title("")  || scatter estimate bucket, mstyle(p1) connect(l) legend(off) xlabel(1 "0-5"  2 "6-10"  3 "11-14" 4 "15-18" 5 "19-21" 6 "22-25")
		graph export "$figures/`x'.eps", replace 
		}


*Create graphs (heterogenity)

	foreach y in heterogeneous_ { 

	foreach x in black nonblack men women fbornfor fbornus focclow focchigh { 

		use "$temp/`y'`x'", clear
		keep if strpos(parm, "age_bin#c.weeks_closed_3wks") | strpos(parm, "1b.age_bin#co.weeks_closed_3wks")
		gen bucket = _n 
		lab def bucket_ts  1 "0-5"  2 "6-10"  3 "11-14" 4 "15-18" 5 "19-21" 6 "22-25" 
		lab values  bucket bucket_ts
		twoway rcap min95 max95 bucket, lstyle(ci) lcolor(gs8) legend(off) xtitle(Age in 1920) ytitle("Attended school (indicator)") title("") ysc(r(-0.05 0.05)) ylab(-0.05(0.01)0.05) yline(0, lpattern(dot) lcolor(black)) xlabel(1 "0-5"  2 "6-10"  3 "11-14" 4 "15-18" 5 "19-21" 6 "22-25")   || scatter estimate bucket, mstyle(p1) connect(l) legend(off)

		graph export "$figures/`y'`x'.eps", replace 
}
}


!mogrify -density 2000 -format png -- *.eps


clear

log close

